{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var action \EasyCorp\Bundle\EasyAdminBundle\Dto\ActionDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}

<twig:ea:Button
    variant="{{ action.variant }}"
    isInvisible="{{ action.usesTextStyle }}"
    class="{{ action.htmlElement.isLink and isIncludedInDropdown|default(false) ? 'dropdown-item' }} {{ action.cssClass }}"
    htmlAttributes="{{ action.htmlAttributes }}"
    htmlElement="{{ action.htmlElement }}"
    type="{{ action.buttonType.value }}"
    icon="{{ action.icon }}"
    href="{{ action.htmlElement.isLink ? action.linkUrl : null }}"
    action="{{ action.htmlElement.isForm ? action.linkUrl : null }}"
    method="{{ action.htmlElement.isForm ? 'POST' : null }}"
>
    {% set action_label = outerScope.action.label|trans %}
    {%- if action_label is not empty -%}<span class="action-label">{{ action_label|raw }}</span>{%- endif -%}
</twig:ea:Button>
